package com.example.demoexcel.optimization.factory;

import com.example.demoexcel.optimization.service.ICarService;
import com.example.demoexcel.optimization.service.impl.JiaoCheServiceImpl;
import com.example.demoexcel.optimization.service.impl.KaCheServiceImpl;
import com.example.demoexcel.optimization.service.impl.SuvServiceImpl;

import java.util.HashMap;
import java.util.Map;

/**
 * 服务工产类
 */
public class CarServicesFactory {
    private static final Map<String, ICarService> map = new HashMap<>();

    static {
        map.put("轿车", new JiaoCheServiceImpl());
        map.put("卡车", new KaCheServiceImpl());
        map.put("SUV", new SuvServiceImpl());
    }

    public static ICarService getCarService(String CarType) {
        return map.get(CarType);
    }
}